﻿/*
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * See product pages for more information.
 * http://closesudoku.codeplex.com
 * Copyright (C), 2010, hrondra
 */

using System;
using System.Collections.Generic;
using System.Text;
using Fluid.Controls;
using System.Drawing;
using Close.Classes;

namespace Close.Controls
{
    class ListBoxBase : FluidListBox
    {
        ThemeClass themeClass = ThemeClass.Settings;

        protected override void InitControl()
        {
            base.InitControl();
            this.EnableDoubleBuffer = true;

            BackColor = themeClass.ListboxBackground;
            ForeColor = themeClass.ListboxForeColor;
            BorderColor = themeClass.ListboxForeColor;
            ScrollBarButtonColor = themeClass.ListboxForeColor;
            ScrollBarButtonBorderColor = themeClass.ListboxForeColor;

        }
        

        protected override void OnPaintItem(ListBoxItemPaintEventArgs e)
        {
            if (e.IsSelected)
            {
                e.BackColor = themeClass.ListboxBackgroundSelected;
                e.ForeColor = themeClass.ListboxForeColorSelected;
            }
            else
            {
                e.BackColor = themeClass.ListboxBackground;
                e.ForeColor = themeClass.ListboxForeColor;
            }

            /*
            if (e.Item is GroupHeader)
            {
                e.BackColor = theme.ListHeaderBackColor;
                e.PaintDefault();
                e.Handled = true;
            }
            else if (e.IsSelected)
            {
                e.BorderColor = e.BorderColor;
                e.PaintHeaderBackground();
                e.PaintDefaultBorder();
                e.BackColor = Color.Transparent;
                e.PaintTemplate();
                e.Handled = true;
            }
             */
            base.OnPaintItem(e);
        }

        public virtual void AddItem()
        {
        }

        /*
        /// <summary>
        /// Gets the Pages class.
        /// </summary>
        public Pages Pages { get { return Parent.Parent.Parent as Pages; } }
         */
        /*
        public override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (!e.Handled)
            {
                switch (e.KeyCode)
                {
                    case System.Windows.Forms.Keys.Right:
                        e.Handled = NavigateForward();
                        break;

                }
            }
        }


        public virtual bool NavigateForward()
        {
            return false;
        }
         */
    }
}
